package E2013;

import java.io.*;

import static java.lang.System.in;

public class Exam2 {
    public static void main(String[] args) {
        String s;
        BufferedReader in = null;
        PrintWriter out = null;
        try{
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new BufferedWriter(new FileWriter("src/data/s.txt")));
            while ( (s = in.readLine())!= null ){
                out.println(s);
                if (s.equals("exit")){
                    break;
                }
            }
//        try{
//            in = new BufferedReader(new InputStreamReader(System.in));
//            out = new PrintWriter("src/data/s.txt");
//            while ( (s = in.readLine())!= null ){
//                out.write(s+"\n");
//                if (s.equals("exit")){
//                    break;
//                }
//            }
        }catch (Exception e){
            e.getStackTrace();
        }finally {
            if (out!=null){
                out.close();
            }
            if (in!=null){
                try {
                    in.close();
                } catch (IOException e2) {
                    e2.getStackTrace();
                }
            }
        }
    }
}
